﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FileControl.ascx.cs" Inherits="ZLCMS.Web.SystemManage.Control.FileControl.FileControl" %>

<table id="<%=ClientID %>" class="list docfiles" width="100%">
    <thead>
        <tr><td colspan="10">
           	        <div class="panelBar">
	        <ul class="toolBar">
<% if (IsShowHistory && Enable)
   {%>
		        <li><a class="add" onclick="ZLAN_FileControl.appendExist('<%= ip_filelistjson.ClientID  %>', '<%=ClientID %>', '<%=FileType %>', '<%=MaxFiles %>');return false;" href="javascript:void(0)">
		            <span>现有添加</span></a></li>
<% }
   if (Enable)
   {%>
                <li><a class="add" onclick="return onNewFile<%=ClientID %>();" href="javascript:void(0)">
                    <span>新增添加</span></a></li>
                <li><a class="add" onclick="return onUrlFile();" href="javascript:void(0)">
                    <span>路径添加</span></a></li>
<% }
   if (AllowDelete && Enable)
   {%>
                <li><a class="delete" href="javascript:void(0)" onclick="ZLAN_FileControl.removeSelectedRows('<%= ip_filelistjson.ClientID  %>', '<%=ClientID %>');">
                    <span>删除勾选</span></a></li>
<% } %>
	        </ul>
        </div></td>
        </tr>
		<tr>
            <th width="5%"><input type="checkbox" group="ids" class="checkboxCtrl"/></th>
			<th width="5%" style="display: none">编号</th>
			<th width="30%">文件名</th>
			<th width="15%">操作</th>
		</tr>
	</thead>
	<tbody>
        <asp:repeater runat="server" id="rp_filelist">
            <ItemTemplate>
            <tr target="uid" rel="<%# Eval("FileId") %>">
                <td height="25px"><input name="ids" value="<%# Eval("FileId") %>" type="checkbox"/></td>
			    <td style="display: none">
                    <input name="filename" value="<%# Eval("FileName") %>" type="text"/>
                    <input name="filepath" value="<%# Eval("FilePath") %>" type="text"/>
                    <input name="fileext" value="<%# Eval("FileExt") %>" type="text"/>
                </td>
			    <td><span class="<%# GetFileSpanClass(Eval("FileName").ToString()) %>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%# Eval("FileName")%></span>
			    </td>
			    <td>   		                
			        <%# GetPreviewAnchor(Eval("FilePath").ToString())%>&nbsp;
			        <a href="/SystemManage/Basics/File/Download.aspx?uid=<%# Eval("FileId") %>">下载</a>&nbsp;
<% if (AllowDelete && Enable)
   {%>
			        <a href="javascript:void(0)" onclick="ZLAN_FileControl.removeRow('<%= ip_filelistjson.ClientID  %>', <%# Eval("FileId") %>, '<%=ClientID %>');">移除</a>
<% } %>			        
			    </td>
		    </tr>
            </ItemTemplate>
        </asp:repeater>
            <tr><td colspan="4" height="20px"></td></tr>
	</tbody>
</table>
<input id="ip_filelistjson" type="hidden" runat="Server" />


<script type="text/javascript">
    $(document).ready(function() {
        $(".prettyPhoto").prettyPhoto();
    });
    function onNewFile<%=ClientID %>() {
        ZLAN_FileControl.appendNew('<%= ip_filelistjson.ClientID  %>', '<%=ClientID %>', '<%=FileType %>', '<%=MaxFiles %>', 
            <%= Newtonsoft.Json.JsonConvert.SerializeObject(Config) %>);
        return false;
    }
    function onUrlFile() {
        ZLAN_FileControl.appenUrl('<%= ip_filelistjson.ClientID  %>', '<%=ClientID %>', '<%=FileType %>', '<%=MaxFiles %>', 
            <%= Newtonsoft.Json.JsonConvert.SerializeObject(Config) %>);
        return false;
    }
</script>
